package com.eorchis.module.remind.dao.impl;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.eorchis.constants.RoleConstants;
import com.eorchis.constants.SystemConstants;
import com.eorchis.core.basedao.dao.IDaoSupport.QueryStringType;
import com.eorchis.core.basedao.dao.impl.HibernateAbstractBaseDao;
import com.eorchis.core.basedao.entity.IBaseEntity;
import com.eorchis.core.basedao.query.condition.IPagingQueryCondition;
import com.eorchis.core.basedao.query.condition.builder.CompareType;
import com.eorchis.core.basedao.query.condition.builder.IConditionBuilder;
import com.eorchis.core.basedao.query.condition.builder.OrderType;
import com.eorchis.core.basedao.query.condition.builder.impl.DefaultQueryConditionBuilder;
import com.eorchis.core.basedao.query.mapper.MapperType;
import com.eorchis.core.basedao.query.mapper.ResultMapperFactory;
import com.eorchis.core.basedao.query.mapper.impl.BeanResultMapper;
import com.eorchis.core.ui.commond.IQueryCommond;
import com.eorchis.module.basedata.domain.BaseData;
import com.eorchis.module.classuser.domain.QueryClassUserBean;
import com.eorchis.module.news.domain.ReceiveUserQueryBean;
import com.eorchis.module.remind.dao.IRemindDao;
import com.eorchis.module.remind.domain.Remind;
import com.eorchis.module.remind.domain.RemindType;
import com.eorchis.module.remind.domain.RemindUser;
import com.eorchis.module.remind.ui.commond.RemindQueryCommond;
import com.eorchis.module.remind.ui.commond.RemindValidCommond;
import com.eorchis.module.trainingclass.domain.TrainingClass;
import com.eorchis.module.trainingclass.querybean.TrainingClassQueryBean;
import com.eorchis.utils.utils.PropertyUtil;

/**
 * Title: RemindDaoImpl<br>
 * Description: 提醒表数据接口实现<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * @author RongSL
 * @createDate 2016-05-06
 * @version $Revision$
 */
@SuppressWarnings("unchecked")
@Repository(value = "com.eorchis.module.remind.dao.impl.RemindDaoImpl")
public class RemindDaoImpl extends HibernateAbstractBaseDao implements IRemindDao {
	
	@Override
	public Class<? extends IBaseEntity> entityClass() {
		return Remind.class;
	}

	@Override
	public void queryConditionProcessor(
			IConditionBuilder defaultQueryConditionBuilder,
			IQueryCommond queryCommond) {
		RemindQueryCommond remindQueryCommond = (RemindQueryCommond)queryCommond;
		defaultQueryConditionBuilder.setBaseQueryString("SELECT t FROM Remind t ");
		defaultQueryConditionBuilder.addCondition("t.remindId", CompareType.IN, remindQueryCommond.getSearchRemindIds());
		defaultQueryConditionBuilder.addCondition("t.remindState", CompareType.EQUAL,remindQueryCommond.getSearchRemindState());
		defaultQueryConditionBuilder.addCondition("t.remindValue", CompareType.LIKE,remindQueryCommond.getSearchRemindValue());
		defaultQueryConditionBuilder.addCondition("t.categoryId", CompareType.LIKE,remindQueryCommond.getSearchCategoryId());
		defaultQueryConditionBuilder.addCondition("t.remindId", CompareType.EQUAL,remindQueryCommond.getSearchRemindId());
	}
	
	/**
	 * 查询管理员
	 * @Date 2016-05-13
	 * @author RongSL
	 * */
	@Override
	public List<RemindUser> findAdministrator(RemindQueryCommond query)throws Exception{
		StringBuffer sql=new StringBuffer("" +
				"select t.userid as \"userId\"," +	// 用户id 
				"t.login_id  as \"loginID\",  " +					//登录号
				"t.user_name as \"userName\",  " +		//用户姓名
				"t.depname  as \"deptName\",  " +			//管辖单位
				"t.role_name as \"roleName\",  " +		//角色名称
				"t.role_code as \"roleCode\"  " +			//角色编码
				"from "+SystemConstants.SYSTEM_CODE+"UUM_SYS_DEP_SYSROLE_GRP_VIEW t where 1=1 ");
		Map<String,Object> params=new HashMap<String,Object>();
		if(PropertyUtil.objectNotEmpty(query.getScopesDepIDs())){
			sql.append(" and t.depid in(:depID) ");
			params.put("depID", query.getScopesDepIDs());
		}
		if(PropertyUtil.objectNotEmpty(query.getDeptId())){
			sql.append(" and t.TREEPATH like concat((select d.TREEPATH from "+SystemConstants.SYSTEM_CODE+"uum_department d where d.depid=:depID),'%') ");
			params.put("depID", query.getDeptId());
		}
		if(PropertyUtil.objectNotEmpty(query.getRoleCode())){
			sql.append(" and t.ROLE_CODE in(:roleCode) ");
			params.put("roleCode", query.getRoleCode());
		}
		if(PropertyUtil.objectNotEmpty(query.getNoUserIDs())&&PropertyUtil.objectNotEmpty(query.getNoUserIDs()[0])){
			sql.append(" and t.userid not in (:noUserIds) ");
			params.put("noUserIds", query.getNoUserIDs()[0].split(","));
		}
		if(PropertyUtil.objectNotEmpty(query.getSearchUserName())){
			sql.append(" and t.user_name like :userName ");
			params.put("userName", "%"+query.getSearchUserName()+"%");
		}
		if(PropertyUtil.objectNotEmpty(query.getSearchLoginID())){
			sql.append(" and t.login_id =:loginID ");
			params.put("loginID", query.getSearchLoginID());
		}
		if(PropertyUtil.objectNotEmpty(query.getNoUserID())){
			sql.append(" and t.userid <>:userId ");
			params.put("userId", query.getNoUserID());
		}
		sql.append(" and t.system_id=:systemCode ");
		sql.append(" and t.role_code=:roleCode ");
		params.put("roleCode",RoleConstants.ROLE_CODE_TWO_ADMIN);
		params.put("systemCode",RoleConstants.XCH_CODE);
		params.put("activeState",ReceiveUserQueryBean.IS_ACTIVE_Y);
		sql.append(" order by t.user_name ");
		
		IConditionBuilder defaultQueryConditionBuilder = new DefaultQueryConditionBuilder();
		defaultQueryConditionBuilder.setBaseQueryString(sql.toString());
		defaultQueryConditionBuilder.setQueryStringType(QueryStringType.SQL);
		IPagingQueryCondition queryCondition = (IPagingQueryCondition) defaultQueryConditionBuilder.buliderQueryCondition();
		queryCondition.setParameters(params);
		Long count = this.count(queryCondition);
		List<RemindUser> findList = new ArrayList<RemindUser>();
		BeanResultMapper mapper = (BeanResultMapper) ResultMapperFactory.getInstance().getMapper(MapperType.Bean);
		mapper.setResultClass(RemindUser.class);
		queryCondition.setResultMapper(mapper);

		if (query.getPage() == -1) {
			findList = (List<RemindUser>) this.findList(queryCondition);
		} else {
			int firstResult = query.calculate(count.longValue());
			findList = (List<RemindUser>) this.findList(queryCondition, firstResult, query.getLimit());
		}
		return findList;
	}
	
	/**
	 * 查询普通学员
	 * @author RongSL
	 * 2018年1月3日
	 * */
	@Override
	public List<RemindUser> findUserList(RemindQueryCommond query)throws Exception{
		StringBuffer sql=new StringBuffer("" +
				"select t.userid as \"userId\", t.login_id as \"loginID\", t.user_name as \"userName\", ud.depname as \"deptName\" "
				+ "FROM "+SystemConstants.SYSTEM_CODE+"uum_user t "
				+ "left join "+SystemConstants.SYSTEM_CODE+"uum_department_user udu on t.USERID=udu.userid "
				+ "left join "+SystemConstants.SYSTEM_CODE+"uum_department ud on udu.depid=ud.depid "
				+ "WHERE t.ACTIVE_STATE=1  and ud.active_state=1 and udu.active_state=1 ");
		Map<String,Object> params=new HashMap<String,Object>();
		if(!PropertyUtil.objectNotEmpty(query.getIfSearchAdmin())){
			sql.append("and t.USERID not in  ( select s.userid from "+SystemConstants.SYSTEM_CODE+"uum_sys_dep_sysrole_grp_view s ) ");
		}
		if(PropertyUtil.objectNotEmpty(query.getScopesDepIDs())){
			sql.append(" and ud.depid in(:depID) ");
			params.put("depID", query.getScopesDepIDs());
		}
		if(PropertyUtil.objectNotEmpty(query.getDeptId())){
			sql.append(" and ud.TREEPATH like concat((select d.TREEPATH from "+SystemConstants.SYSTEM_CODE+"uum_department d where d.depid=:depID),'%') ");
			params.put("depID", query.getDeptId());
		}
		if(PropertyUtil.objectNotEmpty(query.getNoUserIDs())&&PropertyUtil.objectNotEmpty(query.getNoUserIDs()[0])){
			sql.append(" and t.userid not in (:noUserIds) ");
			params.put("noUserIds", query.getNoUserIDs()[0].split(","));
		}
		if(PropertyUtil.objectNotEmpty(query.getSearchUserName())){
			sql.append(" and t.user_name like :userName ");
			params.put("userName", "%"+query.getSearchUserName()+"%");
		}
		if(PropertyUtil.objectNotEmpty(query.getSearchLoginID())){
			sql.append(" and t.login_id =:loginID ");
			params.put("loginID", query.getSearchLoginID());
		}
		params.put("systemCode",RoleConstants.XCH_CODE);
		params.put("activeState",ReceiveUserQueryBean.IS_ACTIVE_Y);
		sql.append(" order by t.user_name ");
		
		IConditionBuilder defaultQueryConditionBuilder = new DefaultQueryConditionBuilder();
		defaultQueryConditionBuilder.setBaseQueryString(sql.toString());
		defaultQueryConditionBuilder.setQueryStringType(QueryStringType.SQL);
		IPagingQueryCondition queryCondition = (IPagingQueryCondition) defaultQueryConditionBuilder.buliderQueryCondition();
		queryCondition.setParameters(params);
		Long count = this.count(queryCondition);
		List<RemindUser> findList = new ArrayList<RemindUser>();
		BeanResultMapper mapper = (BeanResultMapper) ResultMapperFactory.getInstance().getMapper(MapperType.Bean);
		mapper.setResultClass(RemindUser.class);
		queryCondition.setResultMapper(mapper);

		if (query.getPage() == -1) {
			findList = (List<RemindUser>) this.findList(queryCondition);
		} else {
			int firstResult = query.calculate(count.longValue());
			findList = (List<RemindUser>) this.findList(queryCondition, firstResult, query.getLimit());
		}
		return findList;
	}

	/**
	 * 查询培训班
	 * @Date 2016-05-13
	 * @author RongSL
	 * */
	@Override
	public List<TrainingClassQueryBean> findNClass(RemindQueryCommond commond)throws Exception{
		StringBuffer sb=new StringBuffer("select t.class_name \"className\", t.class_id \"classId\",qq.questionnaireName \"questionnaireName\", " +
				"t.enter_begin_time \"enterBeginTime\",t.enter_end_time \"enterEndTime\", STR_TO_DATE(ifnull(t.assess_start_time,t.end_date - 1),'%Y-%m-%d') \"assessStartTime\", "
				+ "STR_TO_DATE(ifnull(t.assess_end_time,t.end_date + 2),'%Y-%m-%d') \"assessEndTime\", " );
		
				//报名结束实际时间
				if(null!=commond.getBmjs())
					sb.append(" ROUND(to_number(t.enter_end_time - to_date(to_char(sysdate, 'yyyy-mm-dd'),'yyyy-mm-dd'))) \"actualDate\",  " );
				//报名开始实际时间
				if(null!=commond.getBmks())
					sb.append(" HOUR(TIMEDIFF(t.enter_begin_time,str_to_date(DATE_FORMAT(now(),'%Y-%m-%d'),'%Y-%m-%d'))/24) \"actualDate\",  " );
				//开班实际时间
				if(null!=commond.getKb())
					sb.append(" ROUND(to_number(t.begin_date - to_date(to_char(sysdate, 'yyyy-mm-dd'),'yyyy-mm-dd'))) \"actualDate\",  " );
				//评估开始实际时间
				if(null!=commond.getPgks())
					sb.append(" ROUND(to_number(t.assess_start_time -to_date(to_char(sysdate, 'yyyy-mm-dd'), 'yyyy-mm-dd'))) \"actualDate\" , " );
				//学员评价实际时间
				if(null!=commond.getXypj())
					sb.append(" ROUND(to_number(t.end_date -to_date(to_char(sysdate, 'yyyy-mm-dd'), 'yyyy-mm-dd'))) \"actualDate\" , " );
				//发邀请函提醒实际时间
				if(null!=commond.getYqh())
					sb.append(" ROUND(to_number(t.begin_date -to_date(to_char(sysdate, 'yyyy-mm-dd'), 'yyyy-mm-dd'))) \"actualDate\" , " );
				sb.append("GROUP_CONCAT(csud.dept_id) \"depIDs\" ");
//				sb.append("CAST(GROUP_CONCAT(CASE WHEN tcp.asign_count <> 0 THEN tcp.dept_name END order by tcp.plan_apply_id) as char) \"trainingDeptName\", "
//						+ "CAST(GROUP_CONCAT(CASE WHEN tcp.asign_count <> 0 THEN concat(tcp.dept_name,':',tcp.asign_count) END order by tcp.plan_apply_id) as char) \"asignCountCount\" ");
				sb.append("from training_class t ");
//				sb.append("left join training_class_plan_apply tcp on t.class_id = tcp.class_id   ");
				sb.append("left join class_sign_up_department csud on t.class_id = csud.class_id   ");
				sb.append("left join (select qso.survey_object_id, CAST(GROUP_CONCAT(q.questionnaire_name) as char) questionnaireName " +
				"from questionnaire_survey_object qso left join questionnaire q on qso.questionnaire_id = q.questionnaire_id " +
				"group by qso.survey_object_id) qq on qq.survey_object_id = t.class_id " +
				"where 1 = 1 ");
		Map<String,Object> params=new HashMap<String,Object>();
		if(!PropertyUtil.objectNotEmpty(commond.getSearchPublishState())){
			sb.append(" and t.publish_state=:publishState ");
			params.put("publishState", TrainingClass.IS_PUBLISH_Y);
		}
		if(!PropertyUtil.objectNotEmpty(commond.getSearchActiveState())){
			sb.append(" and t.active_state=:activeState ");
			params.put("activeState", TrainingClass.IS_ACTIVE_Y);
		}
		
		//报名结束提醒
		if(null!=commond.getBmjs()){
			sb.append(" and TIMEDIFF(t.enter_end_time,now()) between 0 and :day  ");
			params.put("day", commond.getBmjs());//1
		}
		
		//报名开始提醒
		if(null!=commond.getBmks()){
			sb.append(" and HOUR(TIMEDIFF(t.enter_begin_time,str_to_date(DATE_FORMAT(now(),'%Y-%m-%d'),'%Y-%m-%d'))/24)=:day ");
			params.put("day", commond.getBmks());//0
		}
		
		//开班提醒
		if(null!=commond.getKb()){
			sb.append(" and TIMEDIFF(t.begin_date,now()) between 0 and :day ");
			params.put("day", commond.getKb());//5
		}
		
		//评估开始提醒
		if(null!=commond.getPgks()){
			sb.append(" and TIMEDIFF(t.assess_start_time,now()) between 0 and :day ");
			params.put("day", commond.getPgks());//1
		}
		
		//学员评价提醒
		if(null!=commond.getXypj()){
			sb.append(" and TIMEDIFF(t.end_date,now()) between :day and 0 ");
			params.put("day", commond.getXypj());//-2
		}
		
		//学员评价提醒
		if(null!=commond.getYqh()){
			sb.append(" and TIMEDIFF(t.begin_date,now()) between 0 and :day ");
			params.put("day", commond.getYqh());//5
		}
		
		//查询特定培训班
		if(PropertyUtil.objectNotEmpty(commond.getSearchClassIds())){
			sb.append(" and t.class_id in (:classId) ");
			params.put("classId", commond.getSearchClassIds());
		}
		
		//查询特定培训班
		if(PropertyUtil.objectNotEmpty(commond.getAllClass())){
			sb.append(" and t.class_id in (:classId)  ");
			params.put("classId", commond.getSearchClassIds());
		}
		
		return (List<TrainingClassQueryBean>) this.executeFind(QueryStringType.SQL, sb.toString(), params,TrainingClassQueryBean.class);
	}
	
	/**
	 * 查询培训班中的报名情况
	 * @Date 2016-05-13
	 * @author RongSL
	 * */
	@Override
	public List<TrainingClassQueryBean> findSignClass(RemindQueryCommond commond)throws Exception{
		if(PropertyUtil.objectNotEmpty(commond.getSearchClassIds())){
			StringBuffer sb=new StringBuffer(" select  cp.asign_count \"asignCount\",cp.dept_name \"deptName\",nvl(numCount.depUserNum,0) \"depUserNum\" " +
					"from TRAINING_CLASS_PLAN_APPLY cp " +
					" left join base_department_user bdu on cp.dept_id = bdu.depid " +
					"left join TRAINING_CLASS_USER cu on cu.user_id = bdu.userid left join ( " +
					"select count(cu.CLASS_USER_ID) depUserNum,bd.depid from TRAINING_CLASS_USER cu " +
					"left join base_department_user bdu on cu.user_id = bdu.userid " +
					"left join base_department bd on bdu.depid = bd.depid " +
					"where cu.class_id in (:classId) and cu.auditing_state in (1, 5) " +
					"group by bd.depname, cu.class_id,bd.depid  ) numCount on cp.dept_id=numCount.depid " +
					"where cp.CLASS_ID in(:classId) and (cp.asign_count-nvl(numCount.depUserNum,0))>0 " +
					"group by cp.asign_count,cp.dept_name,cp.DEPT_ID,numCount.depUserNum order by cp.DEPT_ID ASC  ");
			Map<String,Object> params=new HashMap<String,Object>();
			params.put("classId", commond.getSearchClassIds());
			return (List<TrainingClassQueryBean>) this.executeFind(QueryStringType.SQL, sb.toString(), params,TrainingClassQueryBean.class);
		}
		return null;
	}
	
	/**
	 * 查询提醒内容
	 * @Date 2016-06-08
	 * @author RongSL
	 * */
	@Override
	public String findRemindDate(String Code)throws Exception{
			StringBuffer sb=new StringBuffer(" select b.data_name \"typeName\",t.system_parameter_name \"systemParameterName\" ,t.system_parameter_value \"systemParameterValue\" " +
					"from BASE_SYSTEM_PARAMETER t left join base_basedata b  on t.system_parameter_name=b.data_code where t.system_parameter_name =:code ");
			Map<String,Object> params=new HashMap<String,Object>();
			if(PropertyUtil.objectNotEmpty(Code)){
				params.put("code", Code);
			}
			return ((Object[]) this.executeFind(QueryStringType.SQL, sb.toString(), params).get(0))[2]+"";
	}
	
	/**
	 * 查询提醒列表
	 * @Date 2016-06-12
	 * @author RongSL
	 * */
	public List<RemindValidCommond> findRemindList(RemindQueryCommond queryCommond) throws Exception{
		StringBuffer HQL=new StringBuffer("select r from Remind r,r.RemindUserList rul where 1=1 ");
		Map<String,Object> params=new HashMap<String,Object>();
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchUserId())){
			HQL.append(" and  rul.replyUserId=:userID ");
			params.put("userID",queryCommond.getSearchUserId());
		}
		IConditionBuilder defaultQueryConditionBuilder  = new DefaultQueryConditionBuilder();
		defaultQueryConditionBuilder.addSort("rul.createDate", OrderType.DESC);
		defaultQueryConditionBuilder.setBaseQueryString(HQL.toString());
		defaultQueryConditionBuilder.setQueryStringType(QueryStringType.HQL);
		defaultQueryConditionBuilder.setResultObject(RemindValidCommond.class);
		IPagingQueryCondition queryCondition = (IPagingQueryCondition) defaultQueryConditionBuilder.buliderQueryCondition();
		queryCondition.setParameters(params);
		Long count=this.count(queryCondition);
		int firstResult = queryCommond.calculate(count.longValue());
		return (List<RemindValidCommond>)this.findList(queryCondition,firstResult,queryCommond.getLimit());
	}
	
	/**
	 * 删除提醒
	 * @Date 2016-06-13
	 * @author RongSL
	 * */
	@Override
	public void deleteRemind(RemindQueryCommond commond) throws Exception{
		StringBuffer HQL=new StringBuffer("delete from Remind r where  r.remindId in (:remindIds)");
		Map<String,Object> params=new HashMap<String,Object>();
		params.put("remindIds", commond.getSearchRemindIds());
		this.executeUpdate(QueryStringType.HQL, HQL.toString(), params);
	}
	
	/**
	 * 更改提醒状态
	 * @Date 2016-06-14
	 * @author RongSL
	 * */
	@Override
	public void updateRemindState(RemindValidCommond valid) throws Exception{
		StringBuffer HQL=new StringBuffer(" update RemindUserLink r set r.lookState=1 where r.remindUserId=:remindUserId");
		Map<String,Object> params=new HashMap<String,Object>();
		params.put("remindUserId", valid.getSearchRemindUserId());
		this.executeUpdate(QueryStringType.HQL, HQL.toString(), params);
	}
	
	/**
	 * 提醒类型查询
	 * @Date 2016-06-13
	 * @author RongSL
	 * */
	@Override
	public BaseData findBaseDate(RemindQueryCommond commond)throws Exception{
		StringBuffer hql=new StringBuffer("select b.activeState as activeState,b.orderNum as orderNum,b.createTime as createTime,b.creator as creator,b.dataName as dataName,b.dataID as dataID,b.dataCode as dataCode " +
				",b.baseDataType as baseDataType " +
				"from BaseData as b where 1=1 ");
		Map<String,Object> params=new HashMap<String,Object>();
		if(PropertyUtil.objectNotEmpty(commond.getSearchBaseDateCode())){
			hql.append(" and b.dataCode=:code ");
			params.put("code", commond.getSearchBaseDateCode());
		}
		return (BaseData)this.executeFind(QueryStringType.HQL, hql.toString(),params,BaseData.class).get(0);
	}
	
	/**
	 * 提醒类型查询
	 * @Date 2016-06-13
	 * @author RongSL
	 * */
	@Override
	public List<BaseData> findBaseDataList(RemindQueryCommond commond)throws Exception{
		StringBuffer hql=new StringBuffer("select b.creator as creator,b.activeState as activeState,b.dataName as dataName,b.dataID as dataID,b.dataCode as dataCode " +
				"from BaseData as b where 1=1 ");
		Map<String,Object> params=new HashMap<String,Object>();
		Field[] fields=RemindType.class.getDeclaredFields();
		String [] typeCode=new String[fields.length];
		for(int i=0;i<fields.length;i++){
			typeCode[i]=fields[i].getName();
		}
		if(PropertyUtil.objectNotEmpty(commond.getSearchRemindType())){
			hql.append(" and b.dataCode in (:code) ");
			params.put("code", commond.getSearchRemindType());
		}else{
			hql.append(" and b.dataCode in (:code) ");
			params.put("code", typeCode);
		}
		if(PropertyUtil.objectNotEmpty(commond.getSearchRemindState())){
			hql.append(" and b.activeState =:state ");
			params.put("state", commond.getSearchRemindState());
		}
		IConditionBuilder defaultQueryConditionBuilder  = new DefaultQueryConditionBuilder();
		defaultQueryConditionBuilder.setBaseQueryString(hql.toString());
		defaultQueryConditionBuilder.setQueryStringType(QueryStringType.HQL);
		defaultQueryConditionBuilder.setResultObject(BaseData.class);
		IPagingQueryCondition queryCondition = (IPagingQueryCondition) defaultQueryConditionBuilder.buliderQueryCondition();
		queryCondition.setParameters(params);
		Long count=this.count(queryCondition);
		int firstResult = commond.calculate(count.longValue());
		return (List<BaseData>)this.findList(queryCondition,firstResult,commond.getLimit());
	}
	
	/**
	 * 更改提醒类型状态
	 * @Date 2016-06-14
	 * @author RongSL
	 * */
	@Override
	public void updateRemindTypeState(RemindQueryCommond commond) throws Exception{
		StringBuffer HQL=new StringBuffer(" update BaseData b set b.activeState=:state where b.dataID in (:ids)");
		Map<String,Object> params=new HashMap<String,Object>();
		params.put("state", commond.getSearchRemindState());
		params.put("ids", commond.getSearchRemindTypeIDs());
		this.executeUpdate(QueryStringType.HQL, HQL.toString(), params);
	}
	
	@Override
	public void updateRemindTypeS(RemindQueryCommond commond) throws Exception{
		StringBuffer HQL=new StringBuffer(" update BaseData b set b.creator=:state where b.dataID in (:ids)");
		Map<String,Object> params=new HashMap<String,Object>();
		params.put("state", commond.getSearchRemindState());
		params.put("ids", commond.getSearchRemindTypeIDs());
		this.executeUpdate(QueryStringType.HQL, HQL.toString(), params);
	}
}
